#!/bin/sh

ACTUAL_DIR=`pwd`
cd /var/www/svn-django/
python manage.py svnrender password > $ACTUAL_DIR/data.pass
python manage.py svnrender rights > $ACTUAL_DIR/data.rights
cd $ACTUAL_DIR

APACHE_SVN_PASS=/etc/apache2/svn.passwd
APACHE_SVN_RIGHTS=/etc/apache2/svn_access.control

diff $APACHE_SVN_PASS data.pass > patch.pass
diff $APACHE_SVN_RIGHTS data.rights > patch.rights

cat patch.pass | wc -l | grep -v "^0$" >/dev/null ; STATUS=$?
if [ "$STATUS" = 0 ] ; then
cat data.pass > $APACHE_SVN_PASS
#echo "TODO svn pass" > /dev/null
fi

cat patch.rights | wc -l | grep -v "^0$" >/dev/null ; STATUS=$?
if [ "$STATUS" = 0 ] ; then
cat data.rights > $APACHE_SVN_RIGHTS
fi

